import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooUserHasAccountController } from '../../../controllers';
const uctoouserHasAccountRouter = new Router();
const userHasAccountController = new uctooUserHasAccountController();

uctoouserHasAccountRouter.post('/add', requireUser, userHasAccountController.add);
uctoouserHasAccountRouter.post('/edit', requireUser, rowLevelPermission('uctoo/user_has_account'), userHasAccountController.edit);
uctoouserHasAccountRouter.post('/del', requireUser, rowLevelPermission('uctoo/user_has_account'), userHasAccountController.delete);

//For getting userHasAccount with permission control
uctoouserHasAccountRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/user_has_account'), userHasAccountController.getSingle);
uctoouserHasAccountRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/user_has_account'), userHasAccountController.getMany);
uctoouserHasAccountRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/user_has_account'), userHasAccountController.getMany);

//#endregion AutoCreateCode
uctoouserHasAccountRouter.post('/connect', requireUser, userHasAccountController.connect);
export default uctoouserHasAccountRouter;
